<template>
	<view class="audit-status">
		<NavBar :title="navTitle" page="audit"/>
		<view class="content">
			<image :src="'/static/icon/components/'+ imgType +'.png'" class="c-img"/>
			<view class="title"> {{ tit }} </view>
			<view class="tips" v-if="tips"> {{ tips }} </view>
			<view class="reject" v-if="errText"> 驳回理由：{{ errText }} </view>
			<view class="btn-box">
				<view class="btn cancel" v-if="cancelText" @tap="goHome"> {{ cancelText }} </view>
				<view class="btn submit" v-if="submitText" @tap="confirm"> {{ submitText }} </view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { onLoad } from '@dcloudio/uni-app';
	import NavBar from '@/components/NavBar.vue';
	const navTitle = ref('')
	const tipsArr = [
		'您的企业入驻商户已提交，请耐心等待平台审核！',
		'报名信息提交成功，平台收到信息会在5个工作日内更您核实信息，请耐心等待！',
		'您可能信息提交有误，可以联系您当地的代理商！也可以编辑信息后继续提交审核！',
	]
	const imgType = ref('padding') //success error padding
	const tit = ref('')
	const tips = ref('')
	const errText = ref('')
	const cancelText = ref('')
	const submitText = ref('')
	const goHome = () => {
		uni.switchTab({ url: '/pages/index/index' })
	}
	const confirm = () => {
		if (submitText.value == '去评价') return uni.navigateTo({ url: '/pages/myEvalute/myEvalute' })
		if (submitText.value == '返回首页') return goHome()
		if (navTitle.value == '审核未通过'&&submitText.value == '编辑信息') return uni.redirectTo({ url: '/pages/agentPages/becomeAgent/becomeAgent' })
		if (navTitle.value == '入驻申请'&&submitText.value == '编辑信息') return uni.redirectTo({ url: '/pages/riderPages/becomeRider/becomeRider?rider=true' })
		if (navTitle.value == '入驻申请未通过'&&submitText.value == '编辑信息') return uni.redirectTo({ url: '/pages/shopPages/enterShop/enterShopType?shop=true' })
	}
	onLoad((e) => {
		const { title, params } = e
		const info = JSON.parse(params)
		// uni.setNavigationBarTitle({ title })
		navTitle.value = title
		if(info.imgType) imgType.value = info.imgType
		tit.value = info?.tit
		tips.value = info?.tips
		errText.value = info?.errText
		cancelText.value = info?.cancelText
		submitText.value = info?.submitText
	})
</script>

<style lang="scss" scoped>
	.audit-status {
		.content {
			text-align: center;
			display: flex;
			flex-direction: column;
			align-items: center;
			.c-img {
				margin-top: 80px;
				width: 110px;
				height: 102px;
			}
			.title {
				max-width: 308px;
				color: #333333;
				font-size: 16px;
				font-weight: 500;
				margin: 20px 0;
				line-height: 20px;
			}
			.tips {
				max-width: 308px;
				font-weight: 400;
				font-size: 14px;
				color: #666666;
				line-height: 20px;
			}
			.reject {
				max-width: 308px;
				text-align: left;
				margin-top: 10px;
				color: #FF3B1E;
				font-size: 14px;
				font-weight: 400;
				line-height: 16px;
			}
			.btn-box {
				margin-top: 40px;
				display: flex;
				justify-content: center;
				align-items: center;
				.btn {
					height: 40px;
					color: #FF3B1E;
					font-size: 16px;
					padding: 0 20px;
					font-weight: 400;
					line-height: 40px;
					border-radius: 99px;
					border: 1px solid #FF3B1E;
					box-sizing: border-box;
				}
				.cancel {
					margin-right: 20px;
				}
				.submit {
					color: #FFFFFF;
					background: #FF3B1E;
					border: 0;
				}
			}
		}
	}
</style>
